<form role="form" method="post">
    <input type="hidden" id="id_attribut" name="data[id_attribut]" value="<?php echo $attribut->id_attribut; ?>">
    <div class="row">    
        <div class="col-md-3">
            <div class="form-group">
                <label for="libelle">Libellé</label>
                <input type="text" class="form-control" id="libelle" name="data[libelle]" placeholder="Libellé" value="<?php echo $attribut->libelle; ?>" required>
            </div>
            <div class="form-group">
                <label for="alias">Alias</label>
                <input type="text" class="form-control" id="alias" name="data[alias]" placeholder="Alias" value="<?php echo $attribut->alias; ?>" required readonly>
            </div>
            <div class="form-group">
                <label for="type">Type du champ</label>
                <select class="form-control" id="type" name="data[type]">
                    <?php echo $fieldTypes; ?>
                </select>
            </div>
            <div class="form-group">
                <label for="active">Activé</label>
                <select class="form-control" id="active" name="data[active]">
                    <option value="1" <?php echo ($attribut->active==1)?'selected="selected"':''; ?>>Oui</option>
                    <option value="0" <?php echo ($attribut->active==0)?'selected="selected"':''; ?>>Non</option>
                </select>
            </div>
            <div class="form-group">
                <label for="css_class">Classe CSS</label>
                <input type="text" class="form-control" id="css_class" name="data[css_class]" placeholder="Classe CSS" value="<?php echo $attribut->css_class; ?>">
            </div>
        </div> 
        <div class="col-md-3">
            <div class="form-group">
                <label for="predefined_option">Options prédéfinies</label>
                <input type="text" class="form-control" id="predefined_option" name="data[predefined_option]" placeholder="Options prédéfinies" value="<?php echo $attribut->predefined_option; ?>">
            </div>
            <div class="form-group">
                <label for="predefined_value">Valeurs prédéfinies</label>
                <input type="text" class="form-control" id="predefined_value" name="data[predefined_value]" placeholder="Valeurs prédéfinies" value="<?php echo $attribut->predefined_value; ?>">
            </div>       
            <div class="form-group">
                <label for="dfault_value">Valeur par défaut</label>
                <select class="form-control" id="type" name="data[default_value]">
                    <?php echo $fieldDefaultValues; ?>
                </select>
            </div>
            <div class="form-group">
                <label for="affected_value">Valeur affectée</label>
                <select class="form-control" id="type" name="data[affected_value]">
                    <?php echo $fieldAffectedValues; ?>
                </select>
            </div>
            <div class="form-group">
                <label for="required">Requis</label>
                <select class="form-control" id="required" name="data[required]">                    
                    <option value="0"<?php echo (($attribut->required)==0)?' selected="selected"':''; ?>>Non</option>
                    <option value="1"<?php echo (($attribut->required)==1)?' selected="selected"':''; ?>>Oui</option>
                </select>
            </div>
        </div> 
        <div class="col-md-3">
            <div class="form-group">
                <label for="col">Positionné après</label>
                <select class="form-control" id="position" name="data[position]">
                    <option value="0">-- Aucun --</option>
                    <?php foreach($allAttributs as $oneAttribut) { ?>
                    <?php if($oneAttribut->id_attribut != $attribut->id_attribut) { ?>
                    <option value="<?php echo $oneAttribut->position; ?>"<?php echo (($attribut->position-1)==$oneAttribut->position)?' selected="selected"':''; ?>><?php echo $oneAttribut->col_title; ?></option>
                    <?php } ?>
                    <?php } ?>
                </select>
            </div>    
            <div class="form-group">
                <label for="col">Afficher en tant que colonne</label>
                <select class="form-control" id="col" name="data[col]">
                    <option value="0" <?php echo ($attribut->col==0)?'selected="selected"':''; ?>>Non</option>
                    <option value="1" <?php echo ($attribut->col==1)?'selected="selected"':''; ?>>Oui</option>
                </select>
            </div>
            <div class="form-group">
                <label for="col_title">Titre de la colonne</label>
                <input type="text" class="form-control" id="col_title" name="data[col_title]" placeholder="Titre de la colonne" value="<?php echo $attribut->col_title; ?>">
            </div>
            <div class="form-group">
                <label for="col">Peut être rechercher</label>
                <select class="form-control" id="search" name="data[search]">
                    <option value="0" <?php echo ($attribut->search==0)?'selected="selected"':''; ?>>Non</option>
                    <option value="1" <?php echo ($attribut->search==1)?'selected="selected"':''; ?>>Oui</option>
                </select>
            </div>
        </div>
    </div>
    <div class="row pull-right">
        <button type="submit" class="btn btn-success">Enregistrer</button>
        <button type="button" class="btn btn-danger" onclick="goTo('index.php?controller=attribut')">Annuler</button>
    </div>
</form>


